package com.example.wanandroid.mapper;

import com.example.wanandroid.pojo.TbCollection;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

@Component
public interface TbCollectionMapper {
    int deleteByPrimaryKey(Long id);

    int insert(TbCollection record);

    int insertSelective(TbCollection record);

    TbCollection selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TbCollection record);

    int updateByPrimaryKey(TbCollection record);

    @Select("SELECT id,userid,question_id AS questionId  FROM tb_collection WHERE question_id = #{questionId} AND userid=#{userid}  LIMIT 1")
    TbCollection selectByQuestionUserId(Long questionId, long userid);


    @Select("SELECT id,userid,question_id AS questionId FROM tb_collection WHERE userid=#{userid} ORDER BY id DESC")
    List<TbCollection> getByCollectionList(long userid);

}